package com.itheima.demo;

import java.time.LocalDate;
import java.time.Period;

public class JDK8DateDemo9 {
    public static void main(String[] args) {
        LocalDate localDate1 = LocalDate.of(2020, 1, 1);
        LocalDate localDate2 = LocalDate.of(2022, 3, 31);

        Period period =Period.between(localDate1,localDate2);

        System.out.println(period.getYears());
        System.out.println(period.getMonths());
        System.out.println(period.getDays());
        System.out.println(period.toTotalMonths());
    }
}
